/**
 * 文本类
 * @author zzhanglin
 * @returns {TextField}
 */
TextField = function()
{
	InteractiveObject.call(this);
	this.className="TextField";
	this.text="";
	this.color ="#000";
	this.font = "12px Arial";
	this.align = "start";
	this.baseline = "top"; 
	this.outline = false;
};
FLASH.extend(TextField ,InteractiveObject); //继承InteractiveObject

//===========getter/setter===================

TextField.prototype.getTextWidth = function(){ return this.getWidth() ;};
TextField.prototype.getTextHeight = function(){ return this.getHeight() ;};

//==================================================

//===========私有方法=====================
/**
 * 输出
 * @param globalAlpha 
 * @param context
 */
TextField.prototype._draw =function( globalAlpha,context )
{
	context.globalAlpha=globalAlpha ;
	context.setTransform( this._worldModelMatrix._a ,this._worldModelMatrix._b,this._worldModelMatrix._c,this._worldModelMatrix._d,
			this._worldModelMatrix._tx,this._worldModelMatrix._ty );
	
	if(this.outline) context.strokeStyle = this.color;
	else context.fillStyle = this.color;
	context.font = this.font;
	context.textAlign = this.align;
	context.textBaseline = this.baseline;
	if(this.outline) context.strokeText(this.text, 0,0);
	else context.fillText(this.text, 0,0);

	this.setWidth( this._getTextWidth(context) );
	this.setHeight( this._getTextWidth(context) );
};

/**
 * 获得文本的宽
 * @param context
 * @returns
 */
TextField.prototype._getTextWidth = function(context)
{
	if(!this.text || this.text.length == 0) return 0;
	return context.measureText(this.text).width;
};
/**
 * 获得文本的高
 * @param context
 * @returns
 */
TextField.prototype._getTextHeight = function(context)
{
	if(!this.text || this.text.length == 0) return 0;
	return context.measureText(this.text).height;
};